var Timer = {
    _showFps : 0,
    showFps(callback){
        this._showFps = 1;
        this._fps.callback = callback;
    },
    //  fps
    _fps : {
        n : 0,
        list : [],
        fps : 0,
        startT : 0,
        lastT : 0
    },

    run(doFun){
        var it = this;
        if(it._showFps){
            if(!it._fps.startT){
                it._fps.startT = it._fps.lastT = (+new Date);
            }
            it._fps.n++;
            if((+new Date) - it._fps.lastT >= 1000){
                it._fps.fps = it._fps.n;
                it._fps.list.push(it._fps.n);
                it._fps.n = 0;
                it._fps.lastT = (+new Date);
                typeof it._fps.callback == "function" &&  it._fps.callback({fps:it._fps.fps,list:it._fps.list});
            }
        }
        if(typeof doFun != "function") doFun = ()=>{}
        doFun();
        requestAnimationFrame(function(){
            it.run(doFun)
        })
    }


    
}